home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
051-060
/
amok56
/
m2maker
/
txt
/
installoptions.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
8KB
|
255 lines
(*---------------------------------------------------------------------------
:Program. m2Maker
:Author. Thomas Stolze
:Address. Goslarsche Str. 32, 3000 Hannover 21, Germany
:Phone. (0)511 / 75 10 77
:Version. V2.0
:Date. 10-Nov-90
:Copyright. Shareware
:Language. Modula-2
:Translator. M2Amiga V3.32d
:Contents. Programming Utility.
:Remark. Supports the M2Amiga System (C) by A+L AG Switzerland
---------------------------------------------------------------------------*)
IMPLEMENTATION MODULE InstallOptions;
IMPORT ExecD;
IMPORT IntuitionL;
IMPORT FileSystem;
FROM Arts IMPORT Assert,BreakPoint;
FROM ASCII IMPORT lf,ff,cr;
FROM Conversions IMPORT ValToStr;
FROM DosD IMPORT accessRead,FileLockPtr;
FROM DosL IMPORT CurrentDir,Delay,DeleteFile,Execute,
Input,IoErr,Lock,Output,Rename,UnLock;
FROM ExecD IMPORT IOStdReqPtr,Message,MsgPortPtr;
FROM ExecL IMPORT CloseDevice,CopyMem,DoIO,FindPort,GetMsg,
OpenDevice,PutMsg,ReplyMsg,WaitPort,Forbid,Permit,
FindResident;
FROM ExecSupport IMPORT CreatePort,CreateStdIO,DeletePort,DeleteStdIO;
FROM FileRequester IMPORT LoadDir,RefreshDisplay;
FROM FileSystem IMPORT Close,Delete,File,Lookup,ReadChar,Response,
WriteBytes,WriteChar;
FROM GraphicsD IMPORT jam2,RastPortPtr;
FROM GraphicsL IMPORT RectFill,SetAPen,SetDrMd;
FROM Input IMPORT inputName,writeEvent;
FROM InputEvent IMPORT InputEvent,Class,Qualifiers,QualifierSet;
FROM InitIntuition IMPORT prgPtr,PrintStatus,RefreshDrawings,
windowHeight;
FROM IntuitionD IMPORT GadgetFlags,GadgetFlagSet,
IntuitionBasePtr,MenuItemFlags,
MenuItemFlagSet,ScreenPtr,WindowPtr;
FROM IntuitionL IMPORT ActivateGadget,ActivateWindow,AddGadget,
BeginRefresh,
ClearMenuStrip,EndRefresh,
LockIBase,
MoveWindow,OffMenu,OnMenu,
RefreshGadgets,RefreshGList,RemoveGadget,
ScreenToFront,SetMenuStrip,SizeWindow,UnlockIBase,
WBenchToFront,WindowToFront,
AddGList,RemoveGList;
FROM Routines IMPORT SendCommand,ExecuteStr,ByeByeCompiler,
ByeByeDebug,ExclChecked,ByeByePool,ByeByeM2Ohm,
InteractiveCompiler,MakePath;
FROM String IMPORT Compare,Concat,Copy,LastPos,Length,FirstPos;
FROM SYSTEM IMPORT ADDRESS,ADR,CAST,LONGSET,BYTE;
FROM TaskMemory IMPORT Allocate,Deallocate;
FROM InOut IMPORT WriteString,WriteInt,WriteLn;
TYPE ResidentTool = (m2c,m2l,m2emacs);
ResidentToolSet = SET OF ResidentTool;
VAR residentTool : ResidentToolSet;
PROCEDURE FilterResidentElement(in : ARRAY OF CHAR; VAR out : ARRAY OF CHAR);
VAR i,j : CARDINAL;
loop,
first : BOOLEAN;
BEGIN
i:=0; j:=0; loop:=TRUE; first:=FALSE;
WHILE (in[i] # 00C) AND loop DO
CASE in[i] OF
" " : CASE first OF
TRUE: loop := FALSE;
| FALSE: WHILE in[i] = " " DO INC(i) END;
END;
ELSE
out[j]:=in[i]; INC(i); INC(j); first:=TRUE;
END;
END;
END FilterResidentElement;
PROCEDURE MakeResident(str : ARRAY OF CHAR; add : BOOLEAN);
VAR dum : ARRAY [0..150] OF CHAR;
BEGIN
IF add THEN
dum:=("Resident "); Concat(dum,str); Concat(dum," ADD");
ExecuteStr(ADR(dum));
ELSE
dum:=("Resident "); Concat(dum,str); Concat(dum," REMOVE");
ExecuteStr(ADR(dum));
END;
END MakeResident;
PROCEDURE ResidentEditor;
VAR dum : ARRAY [0..150] OF CHAR;
BEGIN
IF (checked IN prgPtr^.MenuArray[27].flags) THEN
PrintStatus("Editor resident !");
IF NOT (m2emacs IN residentTool) THEN
FilterResidentElement(prgPtr^.BufferString[4],dum);
MakeResident(dum,TRUE);
INCL(residentTool,m2emacs);
END;
ELSE
FilterResidentElement(prgPtr^.BufferString[4],dum);
MakeResident(dum,FALSE);
EXCL(residentTool,m2emacs);
ExclChecked(27);
END;
END ResidentEditor;
PROCEDURE ResidentCompiler;
VAR dum : ARRAY [0..150] OF CHAR;
BEGIN
IF (checked IN prgPtr^.MenuArray[25].flags) THEN
PrintStatus("Compiler resident !");
IF NOT (m2c IN residentTool) THEN
FilterResidentElement(prgPtr^.BufferString[5],dum);
MakeResident(dum,TRUE);
INCL(residentTool,m2c);
END;
ELSE
FilterResidentElement(prgPtr^.BufferString[5],dum);
MakeResident(dum,FALSE);
EXCL(residentTool,m2c);
ExclChecked(25);
END;
END ResidentCompiler;
PROCEDURE ResidentLinker;
VAR dum : ARRAY [0..150] OF CHAR;
BEGIN
IF (checked IN prgPtr^.MenuArray[26].flags) THEN
PrintStatus("Linker resident !");
IF NOT (m2l IN residentTool) THEN
FilterResidentElement(prgPtr^.BufferString[6],dum);
MakeResident(dum,TRUE);
INCL(residentTool,m2l)
END;
ELSE
FilterResidentElement(prgPtr^.BufferString[6],dum);
MakeResident(dum,FALSE);
EXCL(residentTool,m2l);
ExclChecked(26);
END;
END ResidentLinker;
PROCEDURE InstallDebug;
VAR actual : LONGINT;
dummy : ARRAY [0..150] OF CHAR;
file : File;
BEGIN
IF (checked IN prgPtr^.MenuArray[29].flags) THEN
PrintStatus("Start Debugger !");
Lookup(file,"T:m2Maker.m2d",1024,TRUE);
IF file.res = done THEN
WriteBytes(file,ADR(prgPtr^.BufferString[8]),
Length(prgPtr^.BufferString[8]),actual);
WriteBytes(file,ADR(" > NIL:"),7,actual); WriteChar(file,lf);
WriteBytes(file,ADR("EndCli >NIL:"),12,actual); WriteChar(file,lf);
Close(file);
dummy:='Newshell "NEWCON:0/0/320/24/Interactive Debugger m2:m2d"'+
' FROM T:m2Maker.m2d';
ExecuteStr(ADR(dummy));
WindowToFront(prgPtr^.window); Delay(2);
ELSE
PrintStatus("Debug installation failed !");
END;
ELSE
ByeByeDebug;
END;
END InstallDebug;
PROCEDURE InstallPool;
VAR actual : LONGINT;
dummy : ARRAY [0..150] OF CHAR;
file : File;
PROCEDURE FeedPool;
VAR setenvPtr : POINTER TO ARRAY [0..255] OF CHAR;
ffile : File;
i : CARDINAL;
BEGIN
Allocate(setenvPtr,256);
IF setenvPtr # NIL THEN
MakePath(prgPtr^.BufferString[3],"m2Maker.poo",dummy);
Lookup(ffile,dummy,1024,FALSE);
IF file.res = done THEN
setenvPtr^:='Setenv M2POOL "'; i:=Length(setenvPtr^);
REPEAT
ReadChar(ffile,setenvPtr^[i]);
CASE setenvPtr^[i] OF
| lf: setenvPtr^[i]:=(" ");
ELSE
END;
INC(i);
UNTIL ((ffile.eof) OR (i >= 256));
END;
Close(ffile);
setenvPtr^[i-3]:='"'; setenvPtr^[i-2]:=00C;
WriteBytes(file,setenvPtr,Length(setenvPtr^),actual);
Deallocate(setenvPtr);
END;
END FeedPool;
BEGIN
IF (checked IN prgPtr^.MenuArray[28].flags) THEN
PrintStatus("Start Pool !");
IF FindPort(ADR("M2POOL")) = NIL THEN
Lookup(file,"T:m2Maker.m2p",1024,TRUE);
IF file.res = done THEN
FeedPool; WriteChar(file,lf);
WriteBytes(file,ADR(prgPtr^.BufferString[10]),
Length(prgPtr^.BufferString[10]),actual); WriteChar(file,lf);
WriteBytes(file,ADR("EndCli >NIL:"),12,actual); WriteChar(file,lf);
Close(file);
dummy:='Newshell "NEWCON:0/0/320/24/Interactive Pool m2:m2Pool"'+
' FROM T:m2Maker.m2p';
ExecuteStr(ADR(dummy));
WindowToFront(prgPtr^.window); Delay(2);
PrintStatus("Pool installed.");
ELSE
PrintStatus("Pool installation failed !");
END;
END;
ELSE
ByeByePool;
END;
END InstallPool;
PROCEDURE InstallM2Ohm;
BEGIN
IF (checked IN prgPtr^.MenuArray[30].flags) THEN
PrintStatus("Start M2Ohm !");
IF FindPort(ADR("OHM")) = NIL THEN
ExecuteStr(ADR(prgPtr^.BufferString[16]));
END;
ELSE
ExclChecked(30);
ByeByeM2Ohm;
END;
END InstallM2Ohm;
BEGIN
CLOSE
ExclChecked(25); ResidentCompiler;
ExclChecked(26); ResidentLinker;
ExclChecked(27); ResidentEditor;
END InstallOptions.